import 'package:json_annotation/json_annotation.dart';

@JsonSerializable()
class NovelDetailInfo extends Object {

  @JsonKey(name: '_id')
  String id;

  @JsonKey(name: 'title')
  String title;

  @JsonKey(name: 'author')
  String author;

  @JsonKey(name: 'majorCate')
  String majorCate;

  @JsonKey(name: 'cover')
  String cover;

  @JsonKey(name: 'longIntro')
  String longIntro;

  @JsonKey(name: 'starRatingCount')
  int starRatingCount;

  @JsonKey(name: 'starRatings')
  List<StarRatings> starRatings;

  @JsonKey(name: 'isMakeMoneyLimit')
  bool isMakeMoneyLimit;

  @JsonKey(name: 'contentLevel')
  int contentLevel;

  @JsonKey(name: 'isFineBook')
  bool isFineBook;

  @JsonKey(name: 'safelevel')
  int safelevel;

  @JsonKey(name: 'allowFree')
  bool allowFree;

  @JsonKey(name: 'originalAuthor')
  String originalAuthor;

  @JsonKey(name: 'anchors')
  List<dynamic> anchors;

  @JsonKey(name: 'authorDesc')
  String authorDesc;

  @JsonKey(name: 'rating')
  Rating rating;

  @JsonKey(name: 'hasCopyright')
  bool hasCopyright;

  @JsonKey(name: 'buytype')
  int buytype;

  @JsonKey(name: 'sizetype')
  int sizetype;

  @JsonKey(name: 'superscript')
  String superscript;

  @JsonKey(name: 'currency')
  int currency;

  @JsonKey(name: 'contentType')
  String contentType;

  @JsonKey(name: '_le')
  bool le;

  @JsonKey(name: 'allowMonthly')
  bool allowMonthly;

  @JsonKey(name: 'allowVoucher')
  bool allowVoucher;

  @JsonKey(name: 'allowBeanVoucher')
  bool allowBeanVoucher;

  @JsonKey(name: 'hasCp')
  bool hasCp;

  @JsonKey(name: 'banned')
  int banned;

  @JsonKey(name: 'postCount')
  int postCount;

  @JsonKey(name: 'totalFollower')
  int totalFollower;

  @JsonKey(name: 'latelyFollower')
  int latelyFollower;

  @JsonKey(name: 'followerCount')
  int followerCount;

  @JsonKey(name: 'wordCount')
  int wordCount;

  @JsonKey(name: 'serializeWordCount')
  int serializeWordCount;

  @JsonKey(name: 'retentionRatio')
  String retentionRatio;

  @JsonKey(name: 'updated')
  String updated;

  @JsonKey(name: 'isSerial')
  bool isSerial;

  @JsonKey(name: 'chaptersCount')
  int chaptersCount;

  @JsonKey(name: 'lastChapter')
  String lastChapter;

  @JsonKey(name: 'gender')
  List<dynamic> gender;

  @JsonKey(name: 'tags')
  List<dynamic> tags;

  @JsonKey(name: 'advertRead')
  bool advertRead;

  @JsonKey(name: 'donate')
  bool donate;

  @JsonKey(name: 'copyright')
  String copyright;

  @JsonKey(name: '_gg')
  bool gg;

  @JsonKey(name: 'isForbidForFreeApp')
  bool isForbidForFreeApp;

  @JsonKey(name: 'isAllowNetSearch')
  bool isAllowNetSearch;

  @JsonKey(name: 'limit')
  bool limit;

  @JsonKey(name: 'copyrightInfo')
  String copyrightInfo;

  @JsonKey(name: 'copyrightDesc')
  String copyrightDesc;

  NovelDetailInfo(this.id,this.title,this.author,this.majorCate,this.cover,this.longIntro,this.starRatingCount,this.starRatings,this.isMakeMoneyLimit,this.contentLevel,this.isFineBook,this.safelevel,this.allowFree,this.originalAuthor,this.anchors,this.authorDesc,this.rating,this.hasCopyright,this.buytype,this.sizetype,this.superscript,this.currency,this.contentType,this.le,this.allowMonthly,this.allowVoucher,this.allowBeanVoucher,this.hasCp,this.banned,this.postCount,this.totalFollower,this.latelyFollower,this.followerCount,this.wordCount,this.serializeWordCount,this.retentionRatio,this.updated,this.isSerial,this.chaptersCount,this.lastChapter,this.gender,this.tags,this.advertRead,this.donate,this.copyright,this.gg,this.isForbidForFreeApp,this.isAllowNetSearch,this.limit,this.copyrightInfo,this.copyrightDesc,);

  factory NovelDetailInfo.fromJson(Map<String, dynamic> srcJson) => _$NovelDetailInfoFromJson(srcJson);

  Map<String, dynamic> toJson() => _$NovelDetailInfoToJson(this);

}


@JsonSerializable()
class StarRatings extends Object {

  @JsonKey(name: 'count')
  int count;

  @JsonKey(name: 'star')
  int star;

  StarRatings(this.count,this.star,);

  factory StarRatings.fromJson(Map<String, dynamic> srcJson) => _$StarRatingsFromJson(srcJson);

  Map<String, dynamic> toJson() => _$StarRatingsToJson(this);

}


@JsonSerializable()
class Rating extends Object {

  @JsonKey(name: 'score')
  double score;

  @JsonKey(name: 'count')
  int count;

  @JsonKey(name: 'tip')
  String tip;

  @JsonKey(name: 'isEffect')
  bool isEffect;

  Rating(this.score,this.count,this.tip,this.isEffect,);

  factory Rating.fromJson(Map<String, dynamic> srcJson) => _$RatingFromJson(srcJson);

  Map<String, dynamic> toJson() => _$RatingToJson(this);

}

NovelDetailInfo _$NovelDetailInfoFromJson(Map<String, dynamic> json) {
  return NovelDetailInfo(
    json['_id'] as String,
    json['title'] as String,
    json['author'] as String,
    json['majorCate'] as String,
    json['cover'] as String,
    json['longIntro'] as String,
    json['starRatingCount'] as int,
    (json['starRatings'] as List)
        ?.map((e) =>
    e == null ? null : StarRatings.fromJson(e as Map<String, dynamic>))
        ?.toList(),
    json['isMakeMoneyLimit'] as bool,
    json['contentLevel'] as int,
    json['isFineBook'] as bool,
    json['safelevel'] as int,
    json['allowFree'] as bool,
    json['originalAuthor'] as String,
    json['anchors'] as List,
    json['authorDesc'] as String,
    json['rating'] == null
        ? null
        : Rating.fromJson(json['rating'] as Map<String, dynamic>),
    json['hasCopyright'] as bool,
    json['buytype'] as int,
    json['sizetype'] as int,
    json['superscript'] as String,
    json['currency'] as int,
    json['contentType'] as String,
    json['_le'] as bool,
    json['allowMonthly'] as bool,
    json['allowVoucher'] as bool,
    json['allowBeanVoucher'] as bool,
    json['hasCp'] as bool,
    json['banned'] as int,
    json['postCount'] as int,
    json['totalFollower'] as int,
    json['latelyFollower'] as int,
    json['followerCount'] as int,
    json['wordCount'] as int,
    json['serializeWordCount'] as int,
    json['retentionRatio'] as String,
    json['updated'] as String,
    json['isSerial'] as bool,
    json['chaptersCount'] as int,
    json['lastChapter'] as String,
    json['gender'] as List,
    json['tags'] as List,
    json['advertRead'] as bool,
    json['donate'] as bool,
    json['copyright'] as String,
    json['_gg'] as bool,
    json['isForbidForFreeApp'] as bool,
    json['isAllowNetSearch'] as bool,
    json['limit'] as bool,
    json['copyrightInfo'] as String,
    json['copyrightDesc'] as String,
  );
}

Map<String, dynamic> _$NovelDetailInfoToJson(NovelDetailInfo instance) =>
    <String, dynamic>{
      '_id': instance.id,
      'title': instance.title,
      'author': instance.author,
      'majorCate': instance.majorCate,
      'cover': instance.cover,
      'longIntro': instance.longIntro,
      'starRatingCount': instance.starRatingCount,
      'starRatings': instance.starRatings,
      'isMakeMoneyLimit': instance.isMakeMoneyLimit,
      'contentLevel': instance.contentLevel,
      'isFineBook': instance.isFineBook,
      'safelevel': instance.safelevel,
      'allowFree': instance.allowFree,
      'originalAuthor': instance.originalAuthor,
      'anchors': instance.anchors,
      'authorDesc': instance.authorDesc,
      'rating': instance.rating,
      'hasCopyright': instance.hasCopyright,
      'buytype': instance.buytype,
      'sizetype': instance.sizetype,
      'superscript': instance.superscript,
      'currency': instance.currency,
      'contentType': instance.contentType,
      '_le': instance.le,
      'allowMonthly': instance.allowMonthly,
      'allowVoucher': instance.allowVoucher,
      'allowBeanVoucher': instance.allowBeanVoucher,
      'hasCp': instance.hasCp,
      'banned': instance.banned,
      'postCount': instance.postCount,
      'totalFollower': instance.totalFollower,
      'latelyFollower': instance.latelyFollower,
      'followerCount': instance.followerCount,
      'wordCount': instance.wordCount,
      'serializeWordCount': instance.serializeWordCount,
      'retentionRatio': instance.retentionRatio,
      'updated': instance.updated,
      'isSerial': instance.isSerial,
      'chaptersCount': instance.chaptersCount,
      'lastChapter': instance.lastChapter,
      'gender': instance.gender,
      'tags': instance.tags,
      'advertRead': instance.advertRead,
      'donate': instance.donate,
      'copyright': instance.copyright,
      '_gg': instance.gg,
      'isForbidForFreeApp': instance.isForbidForFreeApp,
      'isAllowNetSearch': instance.isAllowNetSearch,
      'limit': instance.limit,
      'copyrightInfo': instance.copyrightInfo,
      'copyrightDesc': instance.copyrightDesc,
    };

StarRatings _$StarRatingsFromJson(Map<String, dynamic> json) {
  return StarRatings(
    json['count'] as int,
    json['star'] as int,
  );
}

Map<String, dynamic> _$StarRatingsToJson(StarRatings instance) =>
    <String, dynamic>{
      'count': instance.count,
      'star': instance.star,
    };

Rating _$RatingFromJson(Map<String, dynamic> json) {
  return Rating(
    (json['score'] as num)?.toDouble(),
    json['count'] as int,
    json['tip'] as String,
    json['isEffect'] as bool,
  );
}

Map<String, dynamic> _$RatingToJson(Rating instance) => <String, dynamic>{
  'score': instance.score,
  'count': instance.count,
  'tip': instance.tip,
  'isEffect': instance.isEffect,
};


